<?php
  include "include/config.inc.php";
  $drawLoan = $_REQUEST['drawLoan'];
  
 echo  $selectDrawLoan = "SELECT loanDrawId
                       FROM loandraw
                      WHERE loanDrawId = ".$drawLoan;
  $selectDrawLoanRes = mysql_query($selectDrawLoan);
  if($drawLoanRow = mysql_num_rows($selectDrawLoanRes) > 0)
  {
    $selParty = "SELECT loandraw.loanDrawId, party.partyName, party.partyId
                   FROM loandraw
                   JOIN party ON party.partyId = loandraw.partyId
                  WHERE loanDrawId = ".$drawLoan;
    $selPartyRes=mysql_query($selParty);
    $selPartyResRow=mysql_fetch_array($selPartyRes);
  }
  
?>

<select name="partyNameSel" id="partyNameSel" onfocus="findGuaranterId(this);">
  <option value="<?php echo $selPartyResRow['partyId']; ?>"><?php echo $selPartyResRow['partyName']; ?></option>
</select>
